import {
	createRouter,
	createRouterMatcher,
	createWebHashHistory,
	createWebHistory
} from 'vue-router';
const redirectPath = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent) ? '/m_login' : 'p_login';
const routes = [
	{
		path: '/redirect',
		component: ()=>import('./pages/Redirect/index.vue'),
		meta: {
			name: 'redirect'
		}
	},
	{
		path: '/agsitech',
		// redirect: redirectPath,
		component: ()=>import('./pages/Login/index.vue'),
		meta: {
			name: 'agsitech'
		}
	},
	{
		path: '/feihongda',
		// redirect: redirectPath,
		component: ()=>import('./pages/Login/index.vue'),
		meta: {
			name: 'feihongda'
		}
	},
	{
		path: '/huixin',
		// redirect: redirectPath,
		component: ()=>import('./pages/Login/index.vue'),
		meta: {
			name: 'huixin'
		}
	},
	{
		path: '/dongpin',
		// redirect: redirectPath,
		component: ()=>import('./pages/Login/index.vue'),
		meta: {
			name: 'dongpin'
		}
	},
	{
		path: '/pdm',
		// redirect: redirectPath,
		component: ()=>import('./pages/Login/index.vue'),
		meta: {
			name: 'pdm'
		}
	},
	{
		path: '/scm',
		// redirect: redirectPath,
		component: ()=>import('./pages/Login/index.vue'),
		meta: {
			name: 'scm'
		}
	},
	{
		path: '/sso',
		// redirect: redirectPath,
		component: ()=>import('./pages/Login/index.vue'),
		meta: {
			name: 'sso'
		}
	},
	{
		path: '/p_login',
		component: ()=>import('./pages/Login/pc.vue')
	},
	{
		path: '/m_login',
		component: ()=>import('./pages/Login/mobile.vue')
	}
]
// let host = window.location.host;
// const historyBaseUrl = {
// 	'localhost:5173': 'agsitech',
// 	'localhost:5174': 'feihongda'
// }
const router = createRouter({
	// history: createWebHistory(`/${import.meta.env.MODE}`),
	// history: createWebHistory(`/${historyBaseUrl[host]}`),
	history: createWebHistory(`/`),
	routes
})

export default router
